#region imports

using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using MimeCloud.AssetManagement.Business.Interface;

#endregion

namespace MimeCloud.AssetManagement.Business
{
    [Serializable]
    public class AssetContent : IAssetContent
    {
        #region properties

        [XmlElement ( "id" )]
        public int ID { get; set; }

        [XmlIgnore]
        public int AssetID { get; set; }
        
        [XmlElement ( "assetpath" )]
        public string AssetPath { get; set; }
        
        [XmlIgnore]
        public int AssetContentTypeID { get; set; }

        [XmlIgnore]
        public int MimeTypeID { get; set; }

        [XmlIgnore]
        public int StatusID { get; set; }

        [XmlElement ( "creatorid" )]
        public string CreatorID { get; set; }
        
        [XmlElement ( "latesteditorid" )]
        public string LatestEditorID { get; set; }
        
        [XmlIgnore]
        public short LanguageID { get; set; }
        
        [XmlElement ( "creationdate" )]
        public DateTime CreationDate { get; set; }
        
        [XmlElement ( "updateddate" )]
        public DateTime UpdatedDate { get; set; }
        
        [XmlElement ( "asset" )]
        public IAsset Asset { get; set; }
        
        [XmlElement ( "assetcontenttype" )]
        public IAssetContentType AssetContentType { get; set; }
        
        [XmlElement ( "status" )]
        public IStatus Status { get; set; }
        
        [XmlElement ( "mimetype" )]
        public IMimeType MimeType { get; set; }
        
        [XmlElement ( "language" )]
        public ILanguage Language { get; set; }
        
        [XmlElement ( "assetcontentmetadatalist" )]
        public IList<IMetaData> AssetContentMetaDataList { get; set; }
        
        [XmlElement ( "assetcontentrepositorylist" )]
        public IList<IRepository> AssetContentRepositoryList { get; set; }

        #endregion

        #region constructors

        public AssetContent ( ) { }
        public AssetContent ( int id , int assetId , string assetPath , int assetContentTypeId , int mimeTypeId , int statusId , short languageId , string creator , string editor , DateTime created , DateTime edited )
        {
            this.ID = id;
            this.AssetID = assetId;
            this.AssetPath = assetPath;
            this.AssetContentTypeID = assetContentTypeId;
            this.MimeTypeID = mimeTypeId;
            this.StatusID = statusId;
            this.LanguageID = languageId;
            this.CreatorID = creator;
            this.LatestEditorID = editor;
            this.CreationDate = created;
            this.UpdatedDate = edited;
        }
        public AssetContent ( IAssetContent entity )
        {
            this.ID = entity.ID;
            this.AssetID = entity.AssetID;
            this.AssetPath = entity.AssetPath;
            this.AssetContentTypeID = entity.AssetContentTypeID;
            this.MimeTypeID = entity.MimeTypeID;
            this.StatusID = entity.StatusID;
            this.LanguageID = entity.LanguageID;
            this.CreatorID = entity.CreatorID;
            this.LatestEditorID = entity.LatestEditorID;
            this.CreationDate = entity.CreationDate;
            this.UpdatedDate = entity.UpdatedDate;
        }
        public AssetContent ( IAssetContent entity, IAssetContentType assetContentType ) 
        {
            this.ID = entity.ID;
            this.AssetID = entity.AssetID;
            this.AssetPath = entity.AssetPath;
            this.AssetContentTypeID = entity.AssetContentTypeID;
            this.MimeTypeID = entity.MimeTypeID;
            this.StatusID = entity.StatusID;
            this.LanguageID = entity.LanguageID;
            this.CreatorID = entity.CreatorID;
            this.LatestEditorID = entity.LatestEditorID;
            this.CreationDate = entity.CreationDate;
            this.UpdatedDate = entity.UpdatedDate;
            this.AssetContentType = assetContentType;
        }
        public AssetContent ( IAssetContent entity , IMimeType mimeType ) 
        {
            this.ID = entity.ID;
            this.AssetID = entity.AssetID;
            this.AssetPath = entity.AssetPath;
            this.AssetContentTypeID = entity.AssetContentTypeID;
            this.MimeTypeID = entity.MimeTypeID;
            this.StatusID = entity.StatusID;
            this.LanguageID = entity.LanguageID;
            this.CreatorID = entity.CreatorID;
            this.LatestEditorID = entity.LatestEditorID;
            this.CreationDate = entity.CreationDate;
            this.UpdatedDate = entity.UpdatedDate;
            this.MimeType = mimeType;
        }
        public AssetContent ( IAssetContent entity , IList<IRepository> assetContentRepositoryList ) 
        {
            this.ID = entity.ID;
            this.AssetID = entity.AssetID;
            this.AssetPath = entity.AssetPath;
            this.AssetContentTypeID = entity.AssetContentTypeID;
            this.MimeTypeID = entity.MimeTypeID;
            this.StatusID = entity.StatusID;
            this.LanguageID = entity.LanguageID;
            this.CreatorID = entity.CreatorID;
            this.LatestEditorID = entity.LatestEditorID;
            this.CreationDate = entity.CreationDate;
            this.UpdatedDate = entity.UpdatedDate;
            this.AssetContentRepositoryList = assetContentRepositoryList;
        }
        public AssetContent ( IAssetContent entity , IAssetContentType assetContentType, IMimeType mimeType ) 
        {
            this.ID = entity.ID;
            this.AssetID = entity.AssetID;
            this.AssetPath = entity.AssetPath;
            this.AssetContentTypeID = entity.AssetContentTypeID;
            this.MimeTypeID = entity.MimeTypeID;
            this.StatusID = entity.StatusID;
            this.LanguageID = entity.LanguageID;
            this.CreatorID = entity.CreatorID;
            this.LatestEditorID = entity.LatestEditorID;
            this.CreationDate = entity.CreationDate;
            this.UpdatedDate = entity.UpdatedDate;
            this.AssetContentType = assetContentType;
            this.MimeType = mimeType;
        }
        public AssetContent ( IAssetContent entity , IAssetContentType assetContentType , IMimeType mimeType, IList<IRepository> assetContentRepositoryList ) 
        {
            this.ID = entity.ID;
            this.AssetID = entity.AssetID;
            this.AssetPath = entity.AssetPath;
            this.AssetContentTypeID = entity.AssetContentTypeID;
            this.MimeTypeID = entity.MimeTypeID;
            this.StatusID = entity.StatusID;
            this.LanguageID = entity.LanguageID;
            this.CreatorID = entity.CreatorID;
            this.LatestEditorID = entity.LatestEditorID;
            this.CreationDate = entity.CreationDate;
            this.UpdatedDate = entity.UpdatedDate;
            this.AssetContentType = assetContentType;
            this.MimeType = mimeType;
            this.AssetContentRepositoryList = assetContentRepositoryList;
        }
        public AssetContent ( IAssetContent entity , IAssetContentType assetContentType , IMimeType mimeType , IList<IRepository> assetContentRepositoryList , IList<IMetaData> assetContentMetaDataList ) 
        {
            this.ID = entity.ID;
            this.AssetID = entity.AssetID;
            this.AssetPath = entity.AssetPath;
            this.AssetContentTypeID = entity.AssetContentTypeID;
            this.MimeTypeID = entity.MimeTypeID;
            this.StatusID = entity.StatusID;
            this.LanguageID = entity.LanguageID;
            this.CreatorID = entity.CreatorID;
            this.LatestEditorID = entity.LatestEditorID;
            this.CreationDate = entity.CreationDate;
            this.UpdatedDate = entity.UpdatedDate;
            this.AssetContentType = assetContentType;
            this.MimeType = mimeType;
            this.AssetContentRepositoryList = assetContentRepositoryList;
            this.AssetContentMetaDataList = assetContentMetaDataList;
        }

        #endregion

        #region overridden methods

        public override string ToString ( )
        {
            return string.Format ( "ID: {0} - AssetID: {1} - AssetPath: {2} - AssetContentTypeID: {3} - MimeTypeID: {4} - StatusID: {5} - Creator: {6} - Editor: {7} - LanguageID: {8} - Created: {9} - Updated: {10}" ,
                ID.ToString ( ) ,
                AssetID.ToString ( ) ,
                AssetPath ,
                AssetContentTypeID.ToString ( ) ,
                MimeTypeID.ToString ( ) ,
                StatusID.ToString ( ) ,
                CreatorID.ToString ( ) ,
                LatestEditorID.ToString ( ) ,
                LanguageID.ToString ( ) ,
                CreationDate.ToShortDateString ( ) ,
                UpdatedDate.ToShortDateString ( ) );
        }

        #endregion
    }
}
